package com.basin.admin.pojo.dto;

import com.basin.common.core.validate.ValidateGroup;
import com.basin.common.mybatisplus.annotations.Search;
import com.basin.common.mybatisplus.base.BasePage;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.sql.Timestamp;
import java.util.List;

/**
 * @author: Sam ZHONG | sammy1997@aliyun.com
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "租户请求体")
public class TenantDTO extends BasePage {
    @Schema(description = "主键ID")
    @NotNull(message = "主键ID不能为空", groups = {ValidateGroup.Update.class, ValidateGroup.Delete.class})
    private Long id;

    @Schema(description = "租户编码")
    @NotBlank(message = "租户编码不能为空", groups = {ValidateGroup.Add.class})
    @Search
    private String code;

    @Schema(description = "租户名称")
    @NotBlank(message = "租户编码不能为空", groups = {ValidateGroup.Add.class})
    @Search
    private String name;

    @Schema(description = "父级ID")
    @NotNull(message = "父级ID不能为空", groups = {ValidateGroup.Update.class, ValidateGroup.Delete.class})
    private Long parentId;

    @Schema(description = "层级")
    @NotNull(message = "层级不能为空", groups = {ValidateGroup.Update.class, ValidateGroup.Delete.class})
    @Search(Search.SearchType.EQ)
    private Integer level;

    @Schema(description = "过期时间")
    @NotNull(message = "过期时间不能为空", groups = {ValidateGroup.Update.class, ValidateGroup.Add.class})
    private Timestamp expireTime;

    @Schema(description = "描述")
    private String description;

    @Schema(description = "是否有效")
    @NotNull(message = "是否有效不能为空", groups = {ValidateGroup.Update.class, ValidateGroup.Add.class})
    @Search(Search.SearchType.EQ)
    private Integer available;

    @Schema(description = "层级标志集合")
    @Search(value = Search.SearchType.IN, column = "level")
    private List<Integer> levels;

    @Schema(description = "过期时间区间")
    @Search(value = Search.SearchType.BETWEEN, column = "expire_time")
    private Timestamp[] expireTimeInterval;
}
